package com.qdsgjsfk.vision.util;

import android.app.Activity;
import android.content.Intent;
import android.widget.Toast;

import com.qdsgjsfk.vision.ui.LoginActivity;

import org.greenrobot.eventbus.EventBus;

import com.qdsgjsfk.vision.eventbus.StartVision;
import com.qdsgjsfk.vision.ui.StudentDetailActivity;
import com.qdsgjsfk.vision.ui.StudentDetailOtherActivity;

/**
 * @time 2020/5/30 11:09
 */

public class IntentUtil {
    /**
     * 带其他的学生详情
     *
     * @time 2020/5/30 11:32
     */
    public static void ToStudentDetailOtherActivity(Activity context, String studentId, String taskId, int tab, String notExamReason) {

        if (!UtilString.isEmpty( notExamReason )) {
            Toast.makeText( context, "该学生已标注" + notExamReason, Toast.LENGTH_SHORT ).show();
        } else {
            Intent intent = new Intent( context, StudentDetailOtherActivity.class );
            intent.putExtra( "studentId", studentId );
            intent.putExtra( "taskId", taskId );
            intent.putExtra( "tab", tab );
            EventBus.getDefault().postSticky( new StartVision( tab ) );
            context.startActivity( intent );
        }


    }

    /**
     * 不带其他的学生详情
     *
     * @time 2020/5/30 11:29
     */
    public static void ToStudentDetailActivity(Activity context, String studentId, String taskId, int tab, String notExamReason) {
        if (!UtilString.isEmpty( notExamReason )) {
            Toast.makeText( context, "该学生已标注" + notExamReason, Toast.LENGTH_SHORT ).show();
        } else {
            Intent intent = new Intent( context, StudentDetailActivity.class );
            intent.putExtra( "studentId", studentId );
            intent.putExtra( "taskId", taskId );
            intent.putExtra( "tab", tab );
            EventBus.getDefault().postSticky( new StartVision( tab ) );
            context.startActivity( intent );
        }

    }

    public static void ToLoginActivity(Activity context) {
        Intent intent = new Intent( context, LoginActivity.class );
        context.startActivity( intent );
    }


}
